package com.shr.exam.sogou;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		double[] angleArray = new double[count];
		for(int i = 0;i<count;i++){
			angleArray[i] = sc.nextDouble();
		}
		double maxVal = Double.MIN_VALUE ;
		
		for(int i = 0;i<angleArray.length;i++){
			double inAngleVal = angleArray[i] + 180 ;
			int lo = i;
			int up = angleArray.length - 1;
			int mid = lo;
			while(lo <= up){
				mid = (lo + up) / 2;
				if(angleArray[mid] > inAngleVal)
					up = mid - 1;
				else if(angleArray[mid] < inAngleVal)
					lo = mid + 1;
				else break ;
			}
			double val = angleArray[mid] - angleArray[i] ;
			if(val > 180)
				val = 360 - val ;
			maxVal = Math.max(val, maxVal) ;
			if(mid > 0){
				double val2 = angleArray[mid - 1] - angleArray[i] ;
				if(val2 > 180)
					val2 = 360 - val2 ;
				maxVal = Math.max(maxVal, val2) ;
			}
			if(mid < angleArray.length - 1){
				double val3 = angleArray[mid + 1] - angleArray[i] ;
				if(val3 > 180)
					val3 = 360 - val3 ;
				maxVal = Math.max(maxVal, val3) ;
			}
		}
		System.out.println(String.format("%.8f", maxVal));
		sc.close();
	}
}
